<template>

	<!-- Modal container, shown conditionally -->
	<!-- -->
	<view class="modal-overlay" :class="{'modal-block':isModalVisible}" @click="Cancel">
		<view class="login" :class="{'login-block':isModalVisible}">
			<view class="login-box">

				<view class="box-img">
					<image :src="imgBox" mode=""></image>
				</view>

				<view class="box-text">
					确认退出答题吗？
				</view>
				<view class="box-txt">
					退出后，您将无法获得本次的体质分析结果
				</view>

				<view class="btn-box">
					<view class="btn-qu" @click="goBack">
						直接退出
					</view>
					<view class="btn " @click="Cancel" >
						<view class="btn-img" :style="{ 'background-image': `url(${bg})` }">
							继续答题
						</view>

					</view>
				</view>
			</view>
		</view>

	</view>



</template>

<script>
	import config from "../utils/config";
	import {
		toast,
		getStore,
		setStore,
		removeStore
	} from "@/utils/index";
	import {
		listByIds,
		logout,
		getPhone,
		wxlogin
	} from '@/service/api.js';
	export default {
		data() {
			return {
				
				bg: config.ossHost + '2025/01/02/5a65fb0e6c844874a40dc540d8ea1bc2.png',
				imgBox:config.ossHost + '2024/12/29/f1f3731ba0da4bf4a72690c475123d8e.png',
				isModalVisible: false,
			}
		},
		props: {
			Visible: {
				type: Boolean,
				required: false,
			},

		},
		watch: {
			Visible(newTitle) {

				this.isModalVisible = newTitle
			},

		},

		methods: {
			goBack() {
				uni.switchTab({
				  url: '/pages/index/index'  // 目标 TabBar 页面路径
				});
			},
			// Show the modal
			showModal() {
				this.isModalVisible = true;
			},
			// Hide the modal
			Cancel() {
				this.isModalVisible = false;
				this.$emit('isVisibles', this.isModalVisible)
			},

		}

	}
</script>

<style lang="scss" scoped>
	/* Modal overlay background */
	.modal-overlay {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.5);
		/* Dark semi-transparent background */
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		z-index: -1;
		opacity: 0;
		transition: opacity 0.25s ease-in-out;
	}

	.modal-block {
		z-index: 1000;
		opacity: 1;
	}

	/* Modal container */
	.login {
		text-align: center;



		background: #FFFFFF;
		border-radius: 24rpx 24rpx 24rpx 24rpx;

		opacity: 0;
		transform: translateY(-30rpx);
		transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out;

		.login-box {
			padding: 24rpx;
			position: relative;

			.box-img {
				image {
					width: 592rpx;
					height: 236rpx;
				}
			}

			.box-text {
				margin-top: 48rpx;
				font-weight: 500;
				font-size: 36rpx;
				color: #1A1A1A;
			}

			.box-txt {
				margin-top: 24rpx;
				font-size: 28rpx;
				color: #4D4D4D;
			}
		}

		.tit-img {
			position: absolute;
			top: 64rpx;
			width: 616rpx;
			height: 264rpx;
			margin-left: -308rpx;
			left: 50%;

			image {
				width: 616rpx;
				height: 264rpx;
			}
		}


		.btn-box {
			display: flex;
			justify-content: center;
			margin-top: 48rpx;

			view {
				width: 272rpx;
				height: 94rpx;
				line-height: 94rpx;
				text-align: center;
				color: #CCA566;
				border-radius: 60rpx 60rpx 60rpx 60rpx;
				border: 2rpx solid #CCA566;
			}

			.btn {
				margin-left: 32rpx;
				position: relative;
				border: none;

				button {
					position: absolute;
					top: 0;
					left: 0;
					opacity: 0;
					width: 272rpx;
					height: 94rpx;
				}
			}
			.btn-img{
				color: #fff;
				background-size: 100% 100%;
				background-repeat: no-repeat;
			}
		}
	}

	.login-block {
		opacity: 1;
		/* Fade in content */
		transform: translateY(0);
		/* Slide in from top */
	}

	.down {
		width: 64rpx;
		height: 64rpx;

		margin-top: -48rpx;

		image {
			width: 64rpx;
			height: 64rpx;
		}
	}
</style>